﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 美妆产品管理系统.start
{
    public partial class Percom : Form
    {
        public Percom()
        {
            InitializeComponent();
        }

        private void Percom_Load(object sender, EventArgs e)
        {
            DB.GetCn();
            string str = "select * from Employee where employee_Name='" + Login.username + "'";
            DataTable dt = DB.GetDataSet(str);
            txtID.Text = dt.Rows[0][0].ToString();
            txtName.Text = dt.Rows[0][1].ToString();
            txtSex.Text = dt.Rows[0][2].ToString();
            dtpBirth.Value = Convert.ToDateTime(dt.Rows[0][3]);
            dtpHire.Value = Convert.ToDateTime(dt.Rows[0][4]);
            txtAddess.Text = dt.Rows[0][5].ToString();
            txtPhone.Text = dt.Rows[0][6].ToString();
            txtWages.Text = dt.Rows[0][7].ToString();
            txtResume.Text = dt.Rows[0][8].ToString();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            DB.GetCn();
            string str = "update Employee set employee_Name='"
                + txtName.Text + "',Sex='"
                + txtSex.Text + "',Birth_Date='"
                + dtpBirth.Value + "',Hire_Date='"
                + dtpHire.Value + "',EAddress='"
                + txtAddess.Text + "',Telephone='"
                + txtPhone.Text + "',Wages="
                + Convert.ToInt32(txtWages.Text) + ",EResume='"
                + txtResume.Text + "' where employee_ID=" + Convert.ToInt32(txtID.Text) + "";
            DB.sqlEx(str);
            MessageBox.Show("修改成功");
        }

        private void btnCance_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
